import RenderAuthorize from '@/components/Authorized';
// import { getAuthority } from './authority';
import { getCookie } from '@/utils/utils'
/* eslint-disable eslint-comments/disable-enable-pair */

/* eslint-disable import/no-mutable-exports */

// Reload the rights component
// let Authorized = RenderAuthorize(getAuthority());

// const reloadAuthorized = () => {
//   Authorized = RenderAuthorize(getAuthority());
// };

let Authorized = RenderAuthorize(getCookie('role') || 'guest');

const reloadAuthorized = (authority) => {
  Authorized = RenderAuthorize(authority);
};

/**
 * hard code
 * block need it。
 */
window.reloadAuthorized = reloadAuthorized;
export { reloadAuthorized };
export default Authorized;
